<?php
/**
 * Created by PhpStorm.
 * User: geyouwen
 * Date: 17/1/20
 * Time: 下午5:34
 */

namespace App\Model\Bll;


use App\Model\Dao\Member;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Crypt;

class MemberBll extends Model
{

//    public function __construct(Member $member){
//        parent::__construct();
//        $this->member = $member;
//    }

    public function register($request)
    {
        $member = new Member;
        $member->email = $request->email;
        $member->password = md5(sha1($request->password));
        $member->reg_time = time();
        $member->reg_ip = $_SERVER['REMOTE_ADDR'];
        try{
            $member->save();
        } catch(\Exception $e)
        {
            return false;
        }
        return $member;
    }

}